﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Plat.DataRepository;
using Plat.WfProcess.Common;

namespace Plat.WfProcess.Business
{
    /// <summary>
    /// 活动实例的实体对象
    /// </summary>
    public class ActivityInstanceEntity
    {
        public long ApplicationInstanceID
        {
            get;
            set;
        }

        public string ActivityInstanceGUID
        {
            get;
            set;
        }

        public string ActivityGUID
        {
            get;
            set;
        }

        public string ActivityName
        {
            get;
            set;
        }

        public short ActivityTypeID
        {
            get;
            set;
        }

        public short? GatewayDirectionTypeID
        {
            get;
            set;
        }

        public string ProcessInstanceGUID
        {
            get;
            set;
        }

        public string ProcessGUID
        {
            get;
            set;
        }

        public byte CanRenewInstance
        {
            get;
            set;
        }

        public int TokensRequired
        {
            get;
            set;
        }

        public int TokensHad
        {
            get;
            set;
        }

        internal short State
        {
            get;
            set;
        }

        internal byte IsActivityCompleted
        {
            get;
            set;
        }

        internal DateTime CreatedDateTime
        {
            get;
            set;
        }

        internal DateTime? LastUpdatedDateTime
        {
            get;
            set;
        }

        internal DateTime? EndedDateTime
        {
            get;
            set;
        }

        internal long EndedByUserID
        {
            get;
            set;
        }

        internal string EndedByUserName
        {
            get;
            set;
        }

        internal byte RecordStatusInvalid
        {
            get;
            set;
        }

        internal ActivityEntity _activity;
        internal ActivityEntity Activity
        {
            get
            {
                if (_activity == null)
                {
                    _activity = (new ActivityManager(ProcessGUID)).GetActivity(ActivityGUID);
                }
                return _activity;
            }
        }
    }
}
